  ListNode* ReverseList(ListNode* head) {
        // write code here
        if(head==NULL)
            return NULL;
        ListNode *  first, * second,* third;
        first =head->next;
        second=head;
        if(first==NULL)
            return second;
        if(first->next==NULL){
            first->next=second;
            second->next=NULL;
            return first;
        }
        first=head->next->next;
        second=head->next;
        third=head;
        ListNode * tem=first->next;
        first->next=second;
        second->next=third;
        third->next=NULL;
        third=second;
        second=first;
        first=tem;
        while(first!=NULL){
            ListNode * tem=first->next;
            first->next=second;
            second->next=third;
            third=second;
            second=first;
            first=tem;
        }
        return second;
    }